package apistops

import (
	"fmt"
	"git.sr.ht/~mil/mobroute/src/db"
	"git.sr.ht/~mil/mobroute/src/utilfuncs"
	"git.sr.ht/~mil/mobsql"
	"time"
)

type StopsParams struct {
	Filter mobsql.SourcesetFilter `yaml:"filter"`
	From   utilfuncs.Coord        `yaml:"from"`
	Time   *time.Time             `yaml:"time"`
}

func CommandStops(params *StopsParams) (*[]db.StopWalk, error) {
	if dbConnection, err := db.Initialize(&params.Filter, params.Time, true, true, false); err != nil {
		return nil, fmt.Errorf("Failed to initialize db connection: %v", err)
	} else {
		return dbConnection.LoadStopWalks(params.From, 9999999)
	}
	return nil, fmt.Errorf("todo")
}
